import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase="DBshop023_编辑商品评价"
comment="下次还是会回顾"
reply_comment='谢谢亲的支持和好评'
firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)
firefox.find_element_by_link_text("我的订单").click()
firefox.find_element_by_partial_link_text("交易完成").click()
firefox.find_element_by_link_text("尚未评价").click()
firefox.find_element_by_id("comment_body").send_keys(comment)
firefox.find_element_by_xpath("//button").click()

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"商品管理","商品评价")
firefox.find_element_by_link_text("编辑查看").click()
firefox.find_element_by_link_text("评价回复").click()
firefox.find_element_by_id("reply_comment_content").send_keys(reply_comment)
firefox.find_element_by_xpath("//button").click()

try:
    firefox.find_element_by_xpath("//td[text()='%s']"%reply_comment)
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)

